import request from '@/utils/request'

export const reqSkuImg = (spuId) =>{
    return request({
        url:`/admin/product/spuImageList/${spuId}`,
        method:'get'
    })
}

export const reqSkuList = (spuId)=>{
    return request({
        url:`/admin/product/spuSaleAttrList/${spuId}`,
        method:'get'
    })
}

export const reqAttrData=(category1Id,category2Id,category3Id)=>{
    return request({
        url:`/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`,
        method:'get'
    })
}

export const reqUpData=(data)=>{
    return request({
        url:'/admin/product/saveSkuInfo',
        method:'post',
        data
    })
}

export const reqListData = (page,limit)=>{
    return request({
        url:`/admin/product/list/${page}/${limit}`,
        method:'get'
    })
}

export const reqOnSale = (skuId,on)=>{
    let str = on ? "onSale" : "cancelSale"
    return request({
        url:`/admin/product/${str}/${skuId}`,
        method:'get'
    })
}

export const reqRightViewData = (skuId)=>{
    return request({
        url:`/admin/product/getSkuById/${skuId}`,
        method:"get"
    })
}
